<?php

/**
 * 通用功能
 * @author gaofang
 * @date 2018-3-07 00:41
 */

namespace app\admin\controller;

use app\common\controller\Admin;
use app\admin\model\AdminMenu;

class Common extends Admin {

    public $menuModel;

    public function __construct(\think\Request $request = null) {
        parent::__construct($request);
        $this->menuModel = new AdminMenu();
    }

    /**
     * 更新系统缓存
     * @return type
     */
    public function refresh() {
        $this->menuModel->setLeftMenuCache();
        $this->menuModel->setAllMenuCache();
        session('leftmenu', $this->menuModel->getLeftMenu());
        session('allmenu', $this->menuModel->getAllMenu());
        return $this->success('更新成功');
    }

    /**
     * 上传图片
     */
    public function upoladImage() {
        $url = $this->_upload('file');
        $this->success($url);
    }


}
